package hibernateUtil;

import MemoryDB.YuanTable;
import db.GenericHibernateDAO;

public class RedemptioncodeDao extends
		GenericHibernateDAO<Redemptioncode, Integer> {
	public Redemptioncode GetRedemptioncodeByCode(String mCode) {
		return (Redemptioncode) uniqueResult(
				"from Redemptioncode where Code=?", mCode);
	}

	public YuanTable GetRedemptioncodeToTable(String mCode) {
		return GetTable("from Redemptioncode where Code=?", mCode);
	}

	public void DeleteUsedCode(Integer id) {
//		excuteSql("Delete from Redemptioncode where id=" + Integer.parseInt(id), HibernateUtil
//				.getDarkSword2SessionFactory().getCurrentSession());
	update("Delete from Redemptioncode a where a.id=?", id);
	}

	public YuanTable GetRedemptioncodeForTable() {
		return GetTable("from Redemptioncode");
	}
}
